#include "my_stdio.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int main()
{
  mFILE *fp = mfopen("./log.txt","a");//追加模式
  if(fp == NULL)
  {
    return 1;
  }
  int cnt = 10;
  while(cnt)
  {
    char buffer[64];
    snprintf(buffer,sizeof(buffer),"hello message, number is %d",cnt);
    cnt--;
    mfwrite(buffer,strlen(buffer),fp);
    sleep(1);//每一秒向文件中写入一行信息。
  }
  mfclose(fp);
  return 0;
}
